<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('inspection_devices', function (Blueprint $table) {
            $table->comment('设备');
            $table->bigIncrements('id')->comment('ID');
            $table->string('name', 64)->nullable(false)->comment('设备名称');
            $table->string('model', 64)->nullable(false)->comment('设备型号');
            $table->decimal('longitude', 12, 6)->comment('经度');
            $table->decimal('latitude', 12, 6)->comment('纬度');
            $table->decimal('altitude', 8, 2)->comment('海拔高度');
            $table->bigInteger('type_id')->nullable(false)->comment('设备类型ID');
            $table->tinyInteger('status')->nullable(false)->comment('当前状态 1在线 2离线');
            $table->bigInteger('vendor_id')->nullable()->comment('供应商ID');
            $table->bigInteger('service_id')->nullable()->comment('服务商ID');
            $table->string('device', 128)->nullable()->comment('关联设备');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('inspection_devices');
    }
};